<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function getData() {
            try {
                console.log(aaaa)
            } catch {
                //console.log("err")
                throw new Error("传入的参数不符合规则", { cause: "少传入了a参数" })
            }
        }
        //getData()
        try {
            getData()
        } catch (error) {
            console.log(error, error.cause)
        }
    </script>
</body>

</html>